// -----------------------------------------------
// ####### ogre, gorilla and OIS objects #########
// -----------------------------------------------
namespace ogre_objects
{
    Root            * root;
    RenderWindow    * window;
    SceneManager    * scmgr;
    Camera          * camera;
    Viewport        * viewport;
    ConfigFile      * configfile;

    Gorilla :: Silverback   * mGorilla;
    Gorilla :: Screen       * gor_screen;
    Gorilla :: Rectangle    * gor_rect;
    Gorilla :: Layer        * gor_layer;
    Gorilla :: Caption      * gor_caption[15];
    OgreConsole * console;

    OIS::InputManager * inputmanager;
    OIS::Keyboard * keyboard;
    OIS::Mouse * mouse;

    BillboardChainFactory bbchfact;
}
// ------------------------------
// ####### bullet physics #######
// ------------------------------
#ifdef USE_BULLET
namespace bullet_objects
{ 
    btBroadphaseInterface           * broadphase;
    btDefaultCollisionConfiguration * collisionConfig;
    btCollisionDispatcher           * dispatcher;
    btCollisionWorld                * colw;
    //btCharacterControllerInterface * char_ctrl;
    BtOgre::StaticMeshToShapeConverter * mesh2shape;

    BtOgre::DebugCollisionDrawer * col_dgb;
}
#endif

namespace appli
{
    int camera_mode, player_cast;
    float moving_speed, rotating_speed, timeSinceLastFrame;

    std::vector<Entity *> Entities;
    std::vector<SceneNode *> Nodes;
    std::vector<Vec3> velocities;
    std::vector<bool> isMoving;
    std::vector<bool> hasCollided;

    SphereSceneQuery * sphq; // the sphere scenequery
    Ogre::Sphere sph; // see line above

    MaterialPtr mat;
    ColourValue colorval1, colorval2;

    Vec3 translate, translate2;
    Quaternion rotate;
    Entity * e_target, * entplane, * ent_check, * e_ground;
    SceneNode * n_root, * n_master, * n_target, * n_cam, * n_yawpitch_ptr;
        // yaw-pitch-ptr will serve as a pointer to switch between 1st/rd person cam
    game_machine * machine; // all game mechanics
    Bar cast_bar;
}
    // -----------------------------------------------------------------------
    // ####### game mechanics data (this sounds just awesome you know) #######
    // -----------------------------------------------------------------------

namespace recoil
{
    SceneNode * n_recoil;
    float recoil_pitch, recoil_yaw, kickback, recoil_cap, cooldown_step, time_stack, fire_delay;
    bool stop, trigger_pulled;
}


    // std::map<std::string, Vec3> diagnose_vect;
    // std::map<std::string, float> diagnose_float;
        // Vec3 offset;

namespace bullets
{
    float bullet_speed, bullet_speed, offset_x, offset_y
    int nextbullet;
    BillboardChain                  * bb_trace_model;
    std::vector<SceneNode *>        n_bullet;
    std::vector<BillboardChain *>   bb_trace;
    BillboardChain * MakeABullet(string);
}

namespace laser
{
    float  laser_width;
    btVector3 btfrom, btto;
    Vec3 from, to;

    Entity  * last_entity, * current_entity,
            * previous_rayed, * current_rayed;
    SceneNode * n_laserdot, * n_laserbeam;

    BillboardSet * bb_laserdot;
    BillboardChain * bb_beam;
    // Billboard * bboard;

    std::vector<BillboardSet *> bb_dot;
    Ray ray;
    RaySceneQuery * rsq;
#ifdef USE_BULLET
    btCollisionWorld::ClosestRayResultCallback raycallback;
    std::vector<bullet_raycast>     callbacks;
#endif
}

int main()
{



}